Repository navigation
dependency_currency: collapse transitive npm outdated rows per lockfile - #2276
Merged
Merged
Conversation
On an 83-repo audit corpus, 2,358 of 2,664 dep-currency "outdated" rows were transitive packages in npm lockfiles. They are not directly actionable, because they move when the direct dependencies that pull them in are upgraded, and they buried the direct and vulnerable rows. TSV output now prints the outdated rows of transitive npm packages as one outdated row per lockfile when there are more than 3. The row gives the count, how many are a major version behind, and the first 3 names; --json still lists every one. The lockfiles covered are package-lock.json, npm-shrinkwrap.json, yarn.lock and pnpm-lock.yaml. The direct set comes from three sources: - the sibling package.json; - the root and workspace entries of a package-lock v2/v3; - the pnpm importers. Nothing collapses in these cases: - the direct set cannot be read; - a yarn.lock sits beside a package.json that declares workspaces, because workspace manifests are not read. Direct, vulnerable, kev and eol rows are unchanged. Collapsed messages have tabs and newlines replaced, like every other TSV row. A failure while reading the direct set falls back to no collapse rather than dropping the TSV output. On a real corpus repo, outdated rows go from 699 to 60, and the 48 vulnerable and 2 eol rows are unchanged. Tests: 346/346 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF: On a real repo from an 83-repo audit corpus, the
dependency_currency.pyTSV output drops from 699 to 60 "outdated" rows. Transitive npm packages now collapse into one row per lockfile, and the 48 vulnerable and 2 end-of-life rows are unchanged.Why
Across the corpus, 2,358 of 2,664 dep-currency "outdated" rows were transitive packages in npm lockfiles. They are not directly actionable, because they move when the direct dependencies that pull them in are upgraded. They also buried the direct and vulnerable rows.
What changes
In TSV output only, when a lockfile has more than 3 outdated transitive npm packages, they print as one
outdatedrow. That row is at the smallest line and gives:--jsonstill lists every row.Lockfiles covered:
package-lock.json,npm-shrinkwrap.json,yarn.lockandpnpm-lock.yaml.Direct dependencies are read from:
package.json;The change fails safe. Nothing collapses in these cases:
yarn.locksits beside apackage.jsonthat declares workspaces, because workspace manifests are not read;Direct, vulnerable, kev and eol rows are unchanged.
The collapsed message has tabs and newlines replaced, like every other TSV row.
Review
An independent review found 2🔴, 2🟡 and 1🔵.
collect().Tests
scripts/test_dependency_currency_transitive_collapse.py, 10/10. Two of its tests (tab in a name, yarn workspaces) fail before the fold..claude/worktrees.git diff --check;SHA256SUMS.🤖 Generated with Claude Code